<?php

namespace app\model\system;

use app\model\BaseModel;

/**
 *
 */
class SysUserNotice extends BaseModel
{

  /**
   * The table associated with the model.
   *
   * @var string
   */
  protected $table = "sys_user_notice";

  // 多对多
  public function notice()
  {
    return $this->belongsTo(SysNotice::class, "notice_id");
  }

  public function user()
  {
    return $this->belongsTo(SysUser::class, "user_id");
  }

  public function getFormArray(): array
  {
    return [
      "id" => $this->id,
      "title" => $this->title,
      "type" => $this->type,
      "level" => $this->level,
      "publisherName" => $this->publisherName,
      "publishTime" => $this->publishTime,
      "isRead" => $this->isRead
    ];
  }

  public function toArray(array $merges = []): array
  {
    $modeArray = $this->getFormArray();
    return $this->merge($modeArray, $merges);
  }
}
